//
//  MCWithdrawMoneyCell.swift
//  StoreManage
//
//  Created by MC on 2017/12/27.
//  Copyright © 2017年 MC. All rights reserved.
//

import UIKit

class MCWithdrawMoneyCell: UITableViewCell {

    
    var model : MCWithdrawMoneyModel = MCWithdrawMoneyModel() {
        didSet {
            titleLabel.text = model.comment
            timeLabel.text = model.updateTime
            moneyLabel.text = model.type + MCString_judgemantDecimalsIsZero(figure: model.money)
            switch model.status {
            case 2:
                signImageView.image = #imageLiteral(resourceName: "Store_ongoing")
                moneyLabel.textColor = MCColor_16(colorStr: "fea923")
            case 3:
                signImageView.image = #imageLiteral(resourceName: "Store_success")
                moneyLabel.textColor = MCColor_16(colorStr: "22AB39")
            case 4:
                signImageView.image = #imageLiteral(resourceName: "Store_failure")
                moneyLabel.textColor = MCColor_16(colorStr: "C0C0C0")
            default:
                break
            }
        }
    }
    
    
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        backgroundColor = UIColor.white
    
    
        self.addSubview(lineView)
        lineView.snp.remakeConstraints { (make) ->Void in
            make.left.right.bottom.equalTo(0)
            make.height.equalTo(1)
        }
        
        self.addSubview(titleLabel)
        titleLabel.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(15)
            make.bottom.equalTo(self.snp.centerY).offset(-1)
        }
        
        self.addSubview(timeLabel)
        timeLabel.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(15)
            make.top.equalTo(self.snp.centerY).offset(6)
        }
        
        self.addSubview(moneyLabel)
        moneyLabel.snp.remakeConstraints { (make) ->Void in
            make.right.equalTo(-15)
            make.centerY.equalTo(self)
        }

        self.addSubview(signImageView)
        signImageView.snp.remakeConstraints { (make) ->Void in
            make.right.equalTo(-80)
            make.centerY.equalTo(self)
        }


    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    lazy var lineView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.MCGray_light
        return view
    }()
    
    
    
    
    lazy var titleLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(14)
        return label
    }()
    
    lazy var timeLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(14)
        label.textColor = UIColor.MCGray_middle
        return label
    }()

    lazy var moneyLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(16)
        return label
    }()
    
    lazy var signImageView: UIImageView = {
        let imageView = UIImageView()
        return imageView
    }()

}
